﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using QLXuongCNTT.Object;
using QLXuongCNTT.DataLayers;
namespace QLXuongCNTT.ControlLayers
{
    class ctrlPhong
    {
        dtPhong dtphong;
        DataTable tbPhong;
        
        string error;
        objPhong phong;

        internal objPhong Phong
        {
            get { return phong; }
            set { phong = value; }
        }
        public string Error
        {
            get { return error; }
            set { error = value; }
        }
        public ctrlPhong()
        {
            dtphong = new dtPhong();
            phong = new  objPhong();
            error = "";
        }
        public DataTable getPhong()
        {
            tbPhong =dtphong.GetPhong();
            if (!dtphong.Error.Equals(""))
                error = dtphong.Error;
            return tbPhong;
        }
        public void AddPhong()
        {
            DataRow row = dtphong.NewRow();
            row["sophong"] =phong.Sophong;
            row["loaiphong"] = phong.Loaiphong;
            dtphong.Addrow(row);
        }
        public bool save()
        {
            return dtphong.Save();
        }
    }
}
